package rothag.views.gamestep.feed;

import java.awt.Graphics;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import rothag.graphics.GraphicsHelper;
import rothag.graphics.GraphicsParameters;

/**
 * Permet d'affiche la famine d'une ville
 * @author Gaetan
 */
public class FamineJLabel extends JLabel {

    private ImageIcon image;

    public FamineJLabel() {
        super();

        image = GraphicsHelper.getImageIcon(GraphicsParameters.pathDesastreFamine, this);
        if (image.getIconHeight() == -1) {
            GraphicsHelper.afficherErreur("Erreur", "Erreur lors de l'ouverture du fichier image : " + GraphicsParameters.pathDesastreFamine, this).setVisible(true);
        }
    }

    @Override
    public void paint(Graphics g) {
        if (image != null) {
            setIcon(image);
        }
        super.paint(g);
    }

    public ImageIcon getImage() {
        return image;
    }
}
